import { Component, ReactNode } from "react";
import classNames from "classnames";
import Style from "./index.module.scss";

interface MyButtonClassProps {
  type?: any;
  children?: ReactNode;
  onClick?: () => void;
}

export default class MyButtonClass extends Component<MyButtonClassProps> {
  state = {};

  handleBtnClick(e: React.MouseEvent<HTMLDivElement>) {
    // 1.可以使用 window 平台的api
    window.localStorage.setItem(
      "win",
      JSON.stringify({
        name: "h5-cpns",
      })
    );
  }

  render(): ReactNode {
    return (
      <div
        className={classNames(Style["my-btn"], Style[this.props.type])}
        onClick={(e) => this.handleBtnClick(e)}
      >
        {this.props.children}-weapp
      </div>
    );
  }
}
